package com.tool.demo;

import com.tool.demo.util.ThreadPoolUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;

public class Test {

    public static void main(String[] args) {


    }
    public void test02() {


    }


    public void test01() throws ExecutionException, InterruptedException {
        for (int i = 0; i < 50; i++) {
            ThreadPoolUtils.execute(() -> {
                System.out.println("A");
            });
        }

        for (int i = 0; i < 50; i++) {
            ThreadPoolUtils.execute(() -> {
                System.out.println("B");
            });
        }
        for (int i = 0; i < 50; i++) {
            Future<String> future = ThreadPoolUtils.submit(() -> {
                System.out.println("C");
                return "c";
            });
            System.out.println("called:" + future.get());
        }

    }
}
